package com.ymatou.iapi.payment.testcase.old;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.payment.parameter.*;
import com.ymatou.iapi.payment.service.*;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P2;
import com.ymt.utils.tag.P3;
import com.ymttest.business.service.AccountCallService;
import com.ymttest.business.service.PaymentProxyCallService;
import com.ymttest.database.model.PPBussinessOrder;
import com.ymttest.database.model.PPCompensateProcessInfo;
import com.ymttest.database.model.PPPayment;
import com.ymttest.database.model.RefundRequest;
import com.ymttest.database.sqlwapper.AccountDefaultWapper;
import com.ymttest.database.sqlwapper.PaymentDefaultWapper;
import com.ymttest.utils.TestDataManager;
import com.ymttest.utils.YMTDateUtil;

import oracle.security.o3logon.b;

/**
 * 快速退款接口 FreeMaker Template自动生成代码
 */
@TestSuite
public class Ts_FastRefund {
	private static FastRefundBean fastrefundBean;
	private static FastRefundCall fastrefundCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("快速退款接口");
	}

	@Before
	public void caseUp() {
		fastrefundBean = new FastRefundBean();
		fastrefundCall = new FastRefundCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(fastrefundCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_001() {
		Logger.start(true, "渠道10快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2001");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_002() {
		Logger.start(true, "不输入PaymentId提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			// fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			// FIXME message
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("paymentId not be empty", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_003() {
		Logger.start(true, "不输入TradingId提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			// fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("tradingId not be empty", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_004() {
		Logger.start(true, "不输入TradeType提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			// fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			// FIXME message
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("must be greater than or equal to 1", fastrefundCall.getString("ErrorMessage"),
					"验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_005() {
		Logger.start(true, "不输入OrderIdList提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			// List<String> OrderIdList=new ArrayList<String>();
			// OrderIdList.add(TestDataManager.getRandomNum(9));
			// fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals("may not be empty", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_006() {
		Logger.start(true, "不输入AppId提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			// fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals("appId not be empty", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_007() {
		Logger.start(true, "不输入TraceId提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			// fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-",
			// ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("1000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals("参数异常|RefundNo and TraceId cannot be empty.", fastrefundCall.getString("ErrorMessage"),
					"验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_FastRefund_008() {
		Logger.start(true, "PaymentId不存在提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId("123");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("3101", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("支付单号不存在", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_FastRefund_009() {
		Logger.start(true, "PaymentId和TradingId不一致提交退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId() + 1);
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|inconsistent paymentId and tradingId", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_FastRefund_010() {
		Logger.start(true, "支付单连续退款2次退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			fastrefundCall.callService();
			// 重复退款做了幂等条件
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P2.class })
	@TestCase
	public void Tc_FastRefund_011() {
		Logger.start(true, "支付单号和交易号不一致退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);

			AcquireOrderBean aqb2 = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb2);
			PaymentProxyCallService.notifyCall(aqb2);
			String pid2 = PaymentProxyCallService.getPaymentId(aqb2);

			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid2);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|inconsistent paymentId and tradingId", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	/**
	 * 目前不支持多笔退款， 现在多笔退款时RefundRequest只记录第一个OrderId 等重构后再重构这个用例
	 */
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_012() {
		Logger.start(true, "多个订单快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyEquals("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_013() {
		Logger.start(true, "部分快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("1");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_014() {
		Logger.start(true, "多次快速退款,输入部分退款金额总和不超过总金额,快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("1");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			verifyDB(aqb, fastrefundBean, fastrefundCall);
			//TODO 这里要执行一次加mock的退款执行
			String orderId = fastrefundBean.getOrderIdList().get(0);
			List<RefundRequest> RefundRequests = new PaymentDefaultWapper().selectRefundRequestByOrderid(orderId);
			PaymentProxyCallService.executeRefund(RefundRequests.get(0), "10");
			
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			fastrefundCall.addHeader("MockId", mockid);
			fastrefundCall.callService();
			//主键切换前failed 切换后应该成功
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");
			verifyDB(aqb, fastrefundBean, fastrefundCall);
			

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_015() {
		Logger.start(true, "单次输入退款金额超过总金额,快速退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt(aqb.getPayPrice() + 1);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|refund amt limit.", fastrefundCall.getString("ErrorMessage"),
					"验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_016() {
		Logger.start(true, "多次退款,输入部分退款金额总和超过总金额,快速退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("1");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt(aqb.getPayPrice());
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|refund amt limit.", fastrefundCall.getString("ErrorMessage"),
					"验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_017() {
		Logger.start(true, "未支付的订单部分快速退款,失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			PaymentProxyCallService.acquireOrder(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("3401", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("支付单状态错误|invalid payment status", fastrefundCall.getString("ErrorMessage"),
					"验证ErrorMessage");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_018() {
		Logger.start(true, "java重复提交部分退款金额,金额超过总额一半,返回成功(幂等)");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setPayPrice("5");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Thread.sleep(3000);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			String refno=TestDataManager.getRandomUUID().toString().replace("-", "");
			fastrefundBean.setRefundNo(refno);
			fastrefundBean.setRefundAmt("3");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({P2.class})
	@TestCase
	public void Tc_FastRefund_019() {
		Logger.start(true,"支付宝退款资金账户余额不足快速退款,refundRequest.softdeleteFlag=true");
		try {
			PaymentDefaultWapper pdw=new PaymentDefaultWapper();
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			aqb.setUserId("171");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Map account = new AccountDefaultWapper().selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.comment("设置userid171账户资源余额不足");
			new AccountCallService().resetAccount(account.get("sAccountInfoId").toString(), new BigDecimal(0), new BigDecimal(0));
			 FastRefundBean ar = PaymentProxyCallService.fastRefund(aqb);
			Logger.comment("查询部分退款单号");
			PPPayment ppm = PaymentProxyCallService.getPPayment(aqb);
			RefundRequest mrr  = pdw.selectRefundRequestByPaymentId(ppm.getPaymentId()).get(0);
			List<Map> list = pdw.selectRefundRequestByTraceId(ar.getTraceId());
			Logger.verifyEquals(0, list.get(0).get("RefundStatus"), "提交第三方退款成功RefundStatus0");
			Logger.verifyEquals(true, list.get(0).get("SoftDeleteFlag"), "SoftDeleteFlag true");
			new AccountCallService().resetAccount(account.get("sAccountInfoId").toString(), new BigDecimal(1000), new BigDecimal(1000));
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_020() {
		Logger.start(true, "招行优惠支付快速退款,成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall50(aqb,"1");
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			 fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			fastrefundCall.addHeader("MockId", mockid);
			fastrefundCall.callService();
			// FIXME message
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_021() {
		Logger.start(true, "招行支付部分快速退款兼容模式成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall50(aqb,"1");
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("1");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			fastrefundCall.addHeader("MockId", mockid);
			
			fastrefundCall.addHeader("MockResult-Cmb-rspCode", "SUC0000");
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_022() {
		Logger.start(true, "招行支付部分快速退款金额超可退,失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall50(aqb,"1");
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt(aqb.getPayPrice());
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			fastrefundCall.addHeader("MockId", mockid);
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|refund amt limit.", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");


		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_023() {
		Logger.start(true, "招行支付全额快速退款,传金额,成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("50");
			aqb.setUserId("2023");
			aqb.setPayPrice("5");
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall50(aqb,"1");
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+5, "验证余额:支付后=支付前+支付全额(实际支付+招行优惠)");
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("4");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.addHeader("Mock", "1");
			String mockid = TestDataManager.getRandomUUID().toString();
			fastrefundCall.addHeader("MockId", mockid);
//			fastrefundCall.addHeader("MockResult-Cmb-rspCode", "SUC0000");
//			fastrefundCall.addHeader("MockResult-Cmb-cardType", "02");
//			fastrefundCall.addHeader("MockResult-Cmb-orderAmount", "6.00");
//			fastrefundCall.addHeader("MockResult-Cmb-discountAmount", "0.00");
//			fastrefundCall.addHeader("MockResult-Cmb-orderStatus", "0");
//			fastrefundCall.addHeader("MockResult-Cmb-date", YMTDateUtil.getSysTime("yyyyMMdd"));
//			fastrefundCall.addHeader("MockResult-Cmb-orderNo", pid);
			
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			Logger.comment("退款后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+5, "验证余额:退款前=退款后+支付全额(实际支付+招行优惠)");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_024() {
		Logger.start(true, "渠道11快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("11");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2024");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_025() {
		Logger.start(true, "渠道13快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("13");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2025");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_026() {
		Logger.start(true, "渠道14快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("14");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2026");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_027() {
		Logger.start(true, "渠道15快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("15");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2027");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_028() {
		Logger.start(true, "渠道16快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("16");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2028");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P3.class })
	@TestCase
	public void Tc_FastRefund_029() {
		Logger.start(true, "applepay支付快速退款,成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("60");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			 fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			// FIXME message
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_030() {
		Logger.start(true, "applepay支付部分快速退款兼容模式成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("60");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("1");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);

		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_031() {
		Logger.start(true, "applepay支付部分快速退款金额超可退,失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("60");
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt(aqb.getPayPrice()+1);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("5000", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("请求处理失败|refund amt limit.", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");


		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_032() {
		Logger.start(true, "applepay支付全额快速退款,传金额,成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("60");
			aqb.setUserId("2023");
			aqb.setPayPrice("5");
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+5, "验证余额:支付后=支付前+支付全额");
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("5");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			Logger.comment("退款后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+5, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_033() {
		Logger.start(true, "宝付支付全额快速退款,传金额,成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("70");
			aqb.setUserId("2023");
			aqb.setPayPrice("5");
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+5, "验证余额:支付后=支付前+支付全额");
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundBean.setRefundNo(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setRefundAmt("5");
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			Logger.comment("退款后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+5, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_034() {
		Logger.start(true, "渠道9花呗快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("9");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2025");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	//TODO 添加一个资金不足的case
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_035() {
		Logger.start(true, "渠道10余额不足快速退款失败");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("10");
			Integer price=new Random().nextInt(90)+5;
			Integer uid=119;
			aqb.setUserId(uid.toString());
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			
			AccountCallService.resetAccount(AccountCallService.getAccountId(uid), new BigDecimal(0),  new BigDecimal(0));
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");
			//TODO 这里不会生成退款批次号
			
//			List<Map> list = new PaymentDefaultWapper().selectPPAccoutingLogByBizno(fastrefundBean.getRefundId());
//			Logger.verifyEquals(true, list.size()>=1, "验证PP_AccoutingLog表中有记录");
//			if (list.size() > 0) {
//				Map maccountlog = list.get(0);
//				Logger.debug("PP_AccoutingLog:"+maccountlog);
//				// {AccountingType=Refund, Status=1, RespCode=0, RespMsg=操作成功！,
//				// CreatedTime=2016-06-21 16:56:20.807, AccoutingAmt=3.00,
//				// UserId=2837880, BizNo=201606210000001433, Id=41, Memo=快速退款}
//				Logger.verifyEquals("Refund", maccountlog.get("AccountingType").toString(),
//						"验证PP_AccoutingLog表中AccountingType字段");
//				// 快速退款申请成功状态1？待确认
//				Logger.verifyEquals("1", maccountlog.get("Status").toString(), "验证PP_AccoutingLog表中Status字段");
//				Logger.verifyEquals("0", maccountlog.get("RespCode").toString(), "验证PP_AccoutingLog表中RespCode字段");
//				Logger.verifyEquals("操作成功！", maccountlog.get("RespMsg").toString(), "验证PP_AccoutingLog表中RespMsg字段");
//				if (fastrefundBean.getRefundAmt() != null) {
//					if(aqb.getPayType().equals("50")){
//						if(new Double(aqb.getPayPrice()).equals(new Double(fastrefundBean.getRefundAmt()))){
//							Logger.verifyEquals(new Double(aqb.getPayPrice()),
//								new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
//						}else{
//							Logger.comment("手工验证部分快速退款:AccoutingAmt:"+maccountlog.get("AccoutingAmt").toString()+",RefundAmt:"+fastrefundBean.getRefundAmt()+",PayPrice:"+aqb.getPayPrice());
//						}
//					}else{
//					Logger.verifyEquals(new Double(fastrefundBean.getRefundAmt()),
//							new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
//					}
//				} else {
//					Logger.verifyEquals(new Double(aqb.getPayPrice()),
//							new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
//				}
//				Logger.verifyEquals(aqb.getUserId(), maccountlog.get("UserId").toString(), "验证PP_AccoutingLog表中UserId字段");
//				Logger.verifyEquals("快速退款", maccountlog.get("Memo").toString(), "验证PP_AccoutingLog表中Memo字段");
			
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	@Test
	@Category({ P1.class })
	@TestCase
	public void Tc_FastRefund_036() {
		Logger.start(true, "渠道17微信小程序快速退款成功");
		try {
			AcquireOrderBean aqb = PaymentProxyCallService.initAcquireOrder("17");
			Integer price=new Random().nextInt(90)+5;
			aqb.setUserId("2027");
			aqb.setPayPrice(String.valueOf(price));
			Logger.comment("所有交易执行前,查询余额");
			AccountDefaultWapper accw=new AccountDefaultWapper();
			Map m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d0=Double.valueOf(m.get("fAvailAmount").toString());
			
			
			PaymentProxyCallService.acquireOrder(aqb);
			PaymentProxyCallService.notifyCall(aqb);
			Logger.comment("支付回调后,查询余额");
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			
			Double d1=Double.valueOf(m.get("fAvailAmount").toString());
			
			Logger.verifyEquals(d1, d0+price, "验证余额:支付后=支付前+支付全额(实际支付)");
			
			
			
			String pid = PaymentProxyCallService.getPaymentId(aqb);
			fastrefundBean.setAppId("AutoTest");
			// 这个是支付那里的订单号 目前随便填写
			List<String> OrderIdList = new ArrayList<String>();
			OrderIdList.add(TestDataManager.getRandomNum(9));
			fastrefundBean.setOrderIdList(OrderIdList);
			fastrefundBean.setTraceId(TestDataManager.getRandomUUID().toString().replace("-", ""));
			fastrefundBean.setTradeType(1);
			fastrefundBean.setTradingId(aqb.getOrderId());
			fastrefundBean.setPaymentId(pid);
			fastrefundCall.setData(fastrefundBean);
			fastrefundCall.callService();
			Logger.verifyEquals("0", fastrefundCall.getString("ErrorCode"), "验证ErrorCode");
			Logger.verifyIsContains("操作成功！", fastrefundCall.getString("ErrorMessage"), "验证ErrorMessage");

			verifyDB(aqb, fastrefundBean, fastrefundCall);
			m = accw.selectAccountInfoByUserId(Integer.valueOf(aqb.getUserId())).get(0);
			Logger.debug(m);
			Double d2=Double.valueOf(m.get("fAvailAmount").toString());
			Logger.verifyEquals(d1, d2+price, "验证余额:退款前=退款后+支付全额");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
	private void verifyDB(AcquireOrderBean aqb, FastRefundBean fastrefundBean, FastRefundCall fastrefundCall)
			throws InterruptedException {
		String paymentId = fastrefundBean.getPaymentId();
		String orderId = fastrefundBean.getOrderIdList().get(0);

		Logger.comment("验证数据表PP_Payment");
		PPPayment ppPayment = new PaymentDefaultWapper().selectPPPaymentByPaymentId(paymentId).get(0);
		Logger.verifyEquals(0, ppPayment.getPayPrice().compareTo(new BigDecimal(aqb.getPayPrice())),
				"验证PP_Payment表中PayPrice字段");

		Logger.comment("验证数据表RefundRequest");
		
		List<RefundRequest> RefundRequests = new PaymentDefaultWapper().selectRefundRequestByOrderid(orderId);
		Logger.debug(FormatUtil.beanToGSONString(RefundRequests));
		RefundRequest RefundRequest = RefundRequests.get(0);
		// 回调后才会变成2：退款 如果有多条RefundRequests 默认为已经有退款了
		if(RefundRequests.size()>1){
			Logger.verifyEquals(2, ppPayment.getPayStatus(), "验证PP_Payment表中PayStatus字段");
			RefundRequest=RefundRequests.get(1);
		}else{
			//招行mock1条没有paystatus
			if(!aqb.getPayType().equals("50")){
				Logger.verifyEquals(1, ppPayment.getPayStatus(), "验证PP_Payment表中PayStatus字段");
			}
		}
		Logger.verifyEquals(fastrefundBean.getOrderIdList().get(0),RefundRequest.getOrderId(),"验证RefundRequest的OrderId为交易订单号");
		Logger.verifyEquals(fastrefundBean.getOrderIdList().get(0),RefundRequest.getBizNo(),"验证RefundRequest的BizNo为交易订单号");
		Map mRefundRequest=new HashMap<>();
		Logger.verifyEquals(paymentId, RefundRequest.getPaymentId(), "验证RefundRequest表中PaymentId字段与返回一致");
		// Logger.verifyEquals(1, RefundRequest.getTradeNo(),
		// "验证RefundRequest表中TradeNo字段");
		List<String> traceids=new ArrayList<>();
		for ( RefundRequest rr : RefundRequests) {
			traceids.add(rr.getTraceId());
		}
		if (this.fastrefundBean.getRefundNo() == null) {
			Logger.verifyEquals(true, traceids.contains(fastrefundBean.getTraceId()),
					"验证RefundRequest表中TraceId字段与快速退款请求一致");
		} else {
			Logger.verifyEquals(true, traceids.contains(fastrefundBean.getRefundNo()),
					"验证RefundRequest表中TraceId字段与快速退款RefundNo请求一致");
		}

		Logger.verifyEquals(fastrefundBean.getAppId(), RefundRequest.getAppId(), "验证RefundRequest表中AppId字段与快速退款请求一致");
		Logger.verifyEquals(aqb.getPayType(), RefundRequest.getPayType(), "验证RefundRequest表中PayType字段与收单请求一致");
		if (this.fastrefundBean.getRefundAmt() == null) {
			Logger.verifyEquals(0, RefundRequest.getRefundAmount().compareTo(new BigDecimal(aqb.getPayPrice())),
					"验证RefundRequest表中RefundAmount字段与收单请求一致");
		} else {
			Logger.verifyEquals(0,
					RefundRequest.getRefundAmount().compareTo(new BigDecimal(fastrefundBean.getRefundAmt())),
					"验证RefundRequest表中RefundAmount字段与部分退款RefundAmt金额一致");
		}
		Logger.verifyEquals(aqb.getCurrency(), RefundRequest.getCurrencyType(),
				"验证RefundRequest表中CurrencyType字段与收单请求一致");
		Logger.verifyEquals(9, RefundRequest.getApproveStatus(), "验证RefundRequest表中ApproveStatus字段为9：快速退款");
		Logger.verifyEquals(fastrefundBean.getTradeType(), RefundRequest.getTradeType(),
				"验证RefundRequest表中TradeType字段与收单请求一致");
		Logger.verifyEquals(ppPayment.getInstitutionPaymentId(), RefundRequest.getInstPaymentId(),
				"验证RefundRequest表中InstPaymentId字段与表PPPayment中一致");
		// FIXME 这个字段没有确定值
		// Logger.verifyEquals(-1, RefundRequest.getRefundStatus(),
		// "验证RefundRequest表中RefundStatus字段为-1");
		Logger.verifyNotNull(RefundRequest.getRefundBatchNo(), "验证RefundBatchNo非空");
		Logger.comment("验证数据表PP_AccoutingLog");
		List<Map> list = new PaymentDefaultWapper().selectPPAccoutingLogByBizno(RefundRequest.getRefundId());
		Logger.verifyEquals(true, list.size()>=1, "验证PP_AccoutingLog表中有记录");
		if (list.size() > 0) {
			Map maccountlog = list.get(0);
			Logger.debug("PP_AccoutingLog:"+maccountlog);
			// {AccountingType=Refund, Status=1, RespCode=0, RespMsg=操作成功！,
			// CreatedTime=2016-06-21 16:56:20.807, AccoutingAmt=3.00,
			// UserId=2837880, BizNo=201606210000001433, Id=41, Memo=快速退款}
			Logger.verifyEquals("Refund", maccountlog.get("AccountingType").toString(),
					"验证PP_AccoutingLog表中AccountingType字段");
			// 快速退款申请成功状态1？待确认
			Logger.verifyEquals("1", maccountlog.get("Status").toString(), "验证PP_AccoutingLog表中Status字段");
			Logger.verifyEquals("0", maccountlog.get("RespCode").toString(), "验证PP_AccoutingLog表中RespCode字段");
			Logger.verifyEquals("操作成功！", maccountlog.get("RespMsg").toString(), "验证PP_AccoutingLog表中RespMsg字段");
			if (fastrefundBean.getRefundAmt() != null) {
				if(aqb.getPayType().equals("50")){
					if(new Double(aqb.getPayPrice()).equals(new Double(fastrefundBean.getRefundAmt()))){
						Logger.verifyEquals(new Double(aqb.getPayPrice()),
							new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
					}else{
						Logger.comment("手工验证部分快速退款:AccoutingAmt:"+maccountlog.get("AccoutingAmt").toString()+",RefundAmt:"+fastrefundBean.getRefundAmt()+",PayPrice:"+aqb.getPayPrice());
					}
				}else{
				Logger.verifyEquals(new Double(fastrefundBean.getRefundAmt()),
						new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
				}
			} else {
				Logger.verifyEquals(new Double(aqb.getPayPrice()),
						new Double(maccountlog.get("AccoutingAmt").toString()), "验证PP_AccoutingLog表中AccoutingAmt字段");
			}
			Logger.verifyEquals(aqb.getUserId(), maccountlog.get("UserId").toString(), "验证PP_AccoutingLog表中UserId字段");
			Logger.verifyEquals("快速退款", maccountlog.get("Memo").toString(), "验证PP_AccoutingLog表中Memo字段");
		}
		// 发货补偿信息不再写入,直接由服务完成
		// Logger.comment("验证数据表PP_CompensateProcessInfo（发货补偿信息）");
		// PPCompensateProcessInfo ppCompensateProcessInfo =
		// new
		// PPCompensateProcessInfoWapper().selectPPCompensateProcessInfoByCorrelateIdAndCompensateType(
		// paymentId, 1).get(0);
		// Logger.verifyEquals("1", ppCompensateProcessInfo.getAppId(),
		// "验证PP_CompensateProcessInfo表中AppId字段为1");
		// Logger.verifyEquals("Refund",
		// ppCompensateProcessInfo.getMethodName(),
		// "验证PP_CompensateProcessInfo表中MethodName字段为Refund");
		// Logger.verifyEquals(1, ppCompensateProcessInfo.getCompensateType(),
		// "验证PP_CompensateProcessInfo表中CompensateType字段为1:退款");
	}
}
